package com.java2104.service;

import com.java2104.entity.Account;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class AccountService {
    private static Map<String, Account> allAccounts;
    static {
        allAccounts = new HashMap<>();
        allAccounts.put("001", new Account("001", 1000));
        allAccounts.put("002", new Account("002", 2000));
        allAccounts.put("003", new Account("003", 3000));
        allAccounts.put("004", new Account("004", 4000));
        allAccounts.put("005", new Account("005", 5000));
    }
    //编写一个业务方法，通过ID查询账号信息并返回
    public Account findAccById(String id) {
        return allAccounts.get(id);
    }
}
